using MediatR;
using SumerCoreDevOps.Application.Nodes.Queries;
using SumerCoreDevOps.Infrastructure.Scheduling;

namespace SumerCoreDevOps.Application.Nodes.Handlers;

/// <summary>
/// 获取节点统计信息查询处理器
/// </summary>
public class GetNodeStatisticsQueryHandler : IRequestHandler<GetNodeStatisticsQuery, NodeStatistics>
{
    private readonly NodeManager _nodeManager;

    public GetNodeStatisticsQueryHandler(NodeManager nodeManager)
    {
        _nodeManager = nodeManager;
    }

    public async Task<NodeStatistics> Handle(GetNodeStatisticsQuery request, CancellationToken cancellationToken)
    {
        return await _nodeManager.GetStatisticsAsync();
    }
}
